﻿using ControleRepresentante.Data.Catalogs;
using ControleRepresentante.Data.Helpers;

namespace ControleRepresentante.Data.CatalogSteps
{
    internal class CreatePostTableCatalogStep : CatalogStepBase<ControleRepresentanteCatalogStepTypes>
    {
        protected override ControleRepresentanteCatalogStepTypes CatalogStepType
        {
            get { return ControleRepresentanteCatalogStepTypes.CreatePostTableCatalogStep; }
        }

        public override void Execute(IDataAccess dataAccess)
        {
            new CatalogStepHelper(dataAccess)
                .CreateTable("Post")
                    .AddColumn("UserId", ColumnType.Guid, false, false)
                    .AddForeignKey("UserId", "SystemUser")
                    .AddColumn("PedidoId", ColumnType.Guid, false, false)
                    .AddForeignKey("PedidoId", "Pedido", "AttributeHolderId")
                    .AddColumn("Data", ColumnType.DateTime, false, false)
                    .AddColumn("Comentario", ColumnType.LongText, false, false);
        }
    }
}